package thread;

public class SleepDemo2 {
    public static void main(String[] args) {
        Thread baiXue=new Thread(){
            public void run(){
                System.out.println("晚安，睡觉啦，再见这个美丽的世界");
                try {
                    Thread.sleep(10000);
                } catch (InterruptedException e) {
                    System.out.println("干啥");
                }
                System.out.println("白雪公主醒了，哦我的王子");
            }
        };
        Thread King=new Thread(){
            public void run(){
                System.out.println("今天我要去打猎，哇哦，前面有个城堡");
                System.out.println("铛铛铛！");

                for (int i = 0; i < 5; i++) {
                    System.out.println("有人在吗?");
                    try {
                        Thread.sleep(1000);
                    } catch (InterruptedException e) {
                    }
                }
                System.out.println("那我进来了");
                System.out.println("好美！");
                System.out.println("亲一口");
                baiXue.interrupted();
            }
        };
        baiXue.start();
        King.start();
    }
}
